<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<input type="file" name="FileUpload" id="FileUpload">
<button class="layui-btn layui-btn-mini" id="btn_uploadimg">上传图片</button>
<script>

    $("#btn_uploadimg").click(function () {
        var fileObj = document.getElementById("FileUpload").files[0]; // js 获取文件对象

        var formFile = new FormData();
        formFile.append("action", "UploadVMKImagePath");
        formFile.append("file", fileObj); //加入文件对象
        var data = formFile;
        $.ajax({
            url: "/api/common/excleFlieUpload",
            data: data,
            type: "Post",
            dataType: "json",
            cache: true,//上传文件无需缓存
            processData: false,//用于对data参数进行序列化处理 这里必须false
            contentType: false, //必须
            success: function (result) {
                console.log(result);
                alert("上传完成!,"+result);
            }
        })
    })

</script>
</body>
</html>